package com.tttt.aop.proxyproblem;

import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Component;

@Component
public class InnerInvokeService {

    public void f() {
        System.out.println("InnerInvokeService.f() executed...");
        // 内部调用，不能触发AOP逻辑
        g();
    }

    public void f2() {
        System.out.println("InnerInvokeService.f2() executed...");
        // 通过获取的代理对象调用，可以触发AOP逻辑
        InnerInvokeService innerInvoke = (InnerInvokeService) AopContext.currentProxy();
        innerInvoke.g();
    }
    
    public void g() {
        System.out.println("InnerInvokeService.g() executed...");
    }
}
